package dtu.app.model;

import java.util.Comparator;

public class Product implements Comparable<Product> {

	private long id;
	private String name;
	private String category;
	private String unit;
	private long pieces;
	private long totalPieces;
	private double piecesAmount;
	private double totalAmount;
	private double inStockPieces;
	private double inStockAmount;
	private String imagePath;

	public Product(){

	}
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public long getPieces() {
		return pieces;
	}

	public void setPieces(long pieces) {
		this.pieces = pieces;
	}

	public double getPiecesAmount() {
		return piecesAmount;
	}

	public void setPiecesAmount(double piecesAmount) {
		this.piecesAmount = piecesAmount;
	}

	public double getTotalAmount() {
		return totalAmount;
	}

	public void setTotalAmount(double totalAmount) {
		this.totalAmount = totalAmount;
	}
	
	public String getImagePath() {
		return imagePath;
	}

	public void setImagePath(String imagePath) {
		this.imagePath = imagePath;
	}

	public long getTotalPieces() {
		return totalPieces;
	}

	public void setTotalPieces(long totalPieces) {
		this.totalPieces = totalPieces;
	}
	
	

	public double getInStockPieces() {
		return inStockPieces;
	}

	public void setInStockPieces(double inStockPieces) {
		this.inStockPieces = inStockPieces;
	}

	public double getInStockAmount() {
		return inStockAmount;
	}

	public void setInStockAmount(double inStockAmount) {
		this.inStockAmount = inStockAmount;
	}

	public static Comparator<Product> getProductNameComparator() {
		return ProductNameComparator;
	}

	public static void setProductNameComparator(
			Comparator<Product> productNameComparator) {
		ProductNameComparator = productNameComparator;
	}

	public static Comparator<Product> ProductNameComparator = new Comparator<Product>() {

		public int compare(Product p1, Product p2) {

			String name1 = p1.getName().toUpperCase();
			String name2 = p2.getName().toUpperCase();
			
			//ascending order
			return name1.compareTo(name2);

			//descending order
			//return name2.compareTo(name1);
		}

	};

	@Override
	public int compareTo(Product another) {
		return 0;
	}

}
